from rest_framework.viewsets import ModelViewSet
from rest_framework.generics import ListAPIView

from django.contrib.auth.models import Group

from apps.users.models import User
from apps.meiduo_admin.utils import PageNum
from apps.meiduo_admin.serializers.admin import AdminSerializer
from apps.meiduo_admin.serializers.group import GroupSerializer


class AdminModelViewSet(ModelViewSet):
    """展示管理员数据"""
    queryset = User.objects.filter(is_staff=True).order_by('id')

    serializer_class = AdminSerializer

    pagination_class = PageNum


class AdminSimpleView(ListAPIView):
    """管理员管理新增是展示用户组"""
    queryset = Group.objects.all()

    serializer_class = GroupSerializer



